<?php
include_once 'config.inc.php';
class User
{
  //Database connect 
  public function __construct() 
  {
    $db = new dblass();
  }
  // Login process
  public function checkLogin($userName, $password) 
  {
    $password  = md5($password);
    $result    = mysql_query("SELECT userId FROM user WHERE userName='$userName' and password = '$password'");
    $user_data = mysql_fetch_array($result);
    $no_rows   = mysql_num_rows($result);
    if ($no_rows == 1) 
    {
      $_SESSION['login']      = true;
      $_SESSION['s_activId']  = $user_data['userId'];
      $_SESSION['s_userName'] = $userLoginRow['userName'];
      $_SESSION['s_userType'] = $userLoginRow['userType'];
      return TRUE;
    }
    else
    {
      return FALSE;
    }
  }
  // Logout 
  public function logout() 
  {
    $_SESSION['login'] = FALSE;
    session_destroy();
  }
}
?>